<!DOCTYPE html>
  <html>
  <head>
      <meta charset="utf-8">
      <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
      <title>修改登陆密码</title>
      <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
      <script type="text/javascript" src="../../script/jquery-1.x.js"></script>
      <style>

          body{
            background-color: #fcfcfc;
            height:100%;
            padding-top:40px;
          }
          .header{
            width: 100%;height:40px;background: #f5f5f5;
          }
          .leftreturn{
            width:25px;
            height:25px;
            margin:7.5px;
            float: left;
          }

          ul li{
              list-style: none;
          }
          .elpw_tab{
              padding: 5px;
          }
          .elpw_tab li{
              padding: 5px; clear:both;
              height:40px;
          }
          .elpw_tab li label{
              width:30%;line-height:25px; display:block; float:left;
          }
          input{
              outline: none;

          }
          .elpw_input{
              border-bottom: 1px solid #ccc;
              width: 60%;
              outline: none;
          }
          .elpw_tab li:last-child{
          text-align: center;
          }
      </style>
  </head>
  <body>
    <div class="header">
      <img src="../../image/leftreturn.png" alt="" class="leftreturn" onclick="returnsz();">
    </div>

     <ul class="elpw_tab">
      <!-- <li><label>原密码：</label><input type="password" name="oldpassword" id="oldpassword" class="elpw_input" value=""></li>
      <li><label>新密码：</label><input type="password" name="password" id="password" class="elpw_input" value=""></li>
      <li><label>确认密码：</label><input type="password" name="password2" id="password2" class="elpw_input" value=""></li> -->
      <li><input value="发送验证邮箱" type="submit" onclick="doneSubmit()"></li>
    </ul>
    <script type="text/javascript" src="../../script/api.js"></script>
    <script type="text/javascript" src="../../script/SHA1.js"></script>
    <script type="text/javascript">
      user = $api.getStorage('user');

    //检验输入框，并于数据库交互
      function doneSubmit(){

        var now = Date.now();
         appKey = SHA1("A6032422409194"+"UZ"+"808CF36B-60D4-DC5D-C9F3-FB49F9E1FB44"+"UZ"+now)+"."+now

         api.ajax({
             url: 'https://d.apicloud.com/mcm/api/user/resetRequest',
             method: 'post',
             cache:'false',
             headers: {
                 "X-APICloud-AppId": "A6032422409194",
                 "X-APICloud-AppKey": appKey
             },
             data: {
                 values: {
                     username:user[0].username,
                     email:user[0].email,
                     language:"zh_CN"
                 }
             }
         },function(ret, err){
             if (ret) {
                 alert("邮件已经发送，请在邮件链接处修改密码");
                 api.openWin({
                     name: 'index',
                     url: '../../index.html',
                     pageParam: {
                         name: 'test'
                     }
                 });

             } else {
                 alert("邮件发送失败");
             }
         });
      }

    // //重置输入框
    //   function clear2(){
    // document.getElementById('oldpassword').value='';
    // document.getElementById('password').value='';
    // document.getElementById('password2').value='';
    //   }
    </script>
  </body>
  <script type="text/javascript" src="../../script/api.js"></script>
  <script type="text/javascript">
      function returnsz() {
        api.closeWin();
      }
  </script>
  </html>
